import request from "@/utils/request";

export function getGoodsList(page) {
    return request({
        url:"/api/goods",
        method:"get",
        data:{page:page}
    })
}

export function getGoodsDetail(id){
    return request({
        url:"/api/goods/"+id,
        method:"get"
    })
}

export function mygoods(page){
    return request({
        url:'/api/goods/my',
        method:'get',
        data:{page:page}
    })
}

export function publish(goods){
    return request({
        url:"/api/goods",
        method:"post",
        data:{
            name:goods.name,
            price:goods.price,
            image:goods.image,
            game_images:goods.game_images,
            introduction:goods.introduction,
        }
    })
}

export function upImage(file){
    console.log(file)
    return request({
        url:"/api/images",
        method:"post",
        data:{file:file},
    })
}
